package org.example.demo3.common;

import lombok.Data;
//统一返回格式实体类
@Data
public class Ajaxtext {
    private int code;
    private String msg;
    private Object data;
    public static Ajaxtext success (Object data){
        Ajaxtext ajaxtext=new Ajaxtext();
        ajaxtext.setData(data);
        return ajaxtext;
    }
    public static Ajaxtext success (String msg,Object data){
        Ajaxtext ajaxtext=new Ajaxtext();
        ajaxtext.setMsg(msg);
        ajaxtext.setData(data);
        return ajaxtext;
    }
    public static Ajaxtext success (int code,String msg,Object data){
        Ajaxtext ajaxtext=new Ajaxtext();
        ajaxtext.setCode(code);
        ajaxtext.setMsg(msg);
        ajaxtext.setData(data);
        return ajaxtext;
    }
    public static Ajaxtext fail (Object data){
        Ajaxtext ajaxtext=new Ajaxtext();
        ajaxtext.setData(data);
        return ajaxtext;
    }
    public static Ajaxtext fail (String msg,Object data){
        Ajaxtext ajaxtext=new Ajaxtext();
        ajaxtext.setMsg(msg);
        ajaxtext.setData(data);
        return ajaxtext;
    }
    public static Ajaxtext fail (int code,String msg,Object data){
        Ajaxtext ajaxtext=new Ajaxtext();
        ajaxtext.setCode(code);
        ajaxtext.setMsg(msg);
        ajaxtext.setData(data);
        return ajaxtext;
    }
}
